package fei.zhou.lambdalearn.demo3;

/**
 * 描述该类- JPA
 *
 * @author zhoufei
 * @class: Toshow
 * @date 2020/12/22 20:49
 * @Verson 1.0 -2020/12/22 20:49
 * @see
 */
public class Demo5 {
    public static void main(String[] args) {
        method((String name, int age) -> {
            return new Student(name, age);
        });
        System.out.println("-----引用构造器----");
        method(Student::new);
    }
    
    public static void method(Toshow toshow) {
        Student student = toshow.toSee("小苗", 15);
        System.out.println(student.toString());
    }
    
    interface Toshow {
        Student toSee(String name, int age);
    }
    
    static class Student {
        private String name;
        private int age;
        
        public Student(String name, int age) {
            this.name = name;
            this.age = age;
        }
        
        @Override
        public String toString() {
            return "Student{" + "name='" + name + '\'' + ", age=" + age + '}';
        }
    }
    
}